package com.jiepu.daily.corejava.advanceed.part3exception.day0727;

/**
 * @Description:
 * @author: xinjie.txt
 * @date: 2020/7/27  10:44note
 */
public class ExceptionDemo1 {
	public static void main(String[] args) {

		try {
			Class.forName("com.jiepu.daily.corejava.advanceed.part3exception.te");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (UnknownError e) {
			e.printStackTrace();
		} finally {
			System.out.println("DEFAULT Finaly...");
		}


		// 异常最终被捕获
		try {
			test(4);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

	}

	public static int test(int a) throws ClassNotFoundException {
		// 上抛异常  throws
		a();

		try {
			int result = 10 / a;
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			System.out.println("finally...");
		}

		return 0;
	}

	static void a() throws ClassNotFoundException {
		// 上抛异常  throws
		Class.forName("df");

		ExceptionDemo2 exceptionDemo2 = new ExceptionDemo2();
		exceptionDemo2.a();
	}

}
